﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using IHISCETeim.Library;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using IHISCETeim.Model;

namespace IHISCETeim.DAL
{
    public class JSUserDWFDAL
    {
        public static int Add(string UserName, Guid DWFID)
        {
            Database DB = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = DB.GetStoredProcCommand("JSUserDWF_Add", UserName, DWFID);
            return Convert.ToInt32(DB.ExecuteScalar(dbCommand));
        }
        public static bool DeleteExpiryDWF()
	    {
		    Database DB = DatabaseFactory.CreateDatabase();		
		
			DbCommand dbCommand = DB.GetStoredProcCommand("JSUserDWF_DeleteExpiryDWF");			
		 	try
            {
                DB.ExecuteScalar(dbCommand);
                return true;
            }
            catch
            {
                return false;
            }
	    }
        /// <summary>
        /// 获取用户所有的权限图纸
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public static IDataReader GetListByUserName(string UserName)
        {
            Database DB = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = DB.GetStoredProcCommand("JSUserDWF_GetListByUserName", UserName);
            return DB.ExecuteReader(dbCommand);
        }
    }
}
